#include <iostream>

using namespace std;

int main(void)
{
    //加减乘除
    int a1 = 10;
    int b1 = 3;

    cout << a1 + b1 << endl;
    cout << a1 - b1 << endl;
    cout << a1 * b1 << endl;
    cout << a1 / b1 << endl;//两个整型数相除，结果依然是整数，将小数部分去除
    //除数不能为0

    double d1 = 0.5;
    double d2 = 0.22;
    cout << d1 / d2 << endl;

    cout << a1 % b1 << endl;
    cout << 10 % 20 << endl;
    //取模运算后数也不能为0
    //小数是不可以做取模运算的

    //前置递增
    int a = 10;
    ++a;
    cout << a << endl;

    //后置递增
    int b = 10;
    b++;
    cout << b << endl;

    //前置和后置的区别
    //前置递增：先让变量+1，然后进行表达式运算
    int a2 = 10;
    int b2 = ++a2 * 10;
    cout << "a2 = " << a2 << endl;
    cout << "b2 = " << b2 << endl;

    //后置递增：先进行表达式运算，然后让变量+1
    int a3 = 10;
    int b3 = a3++ * 10;
    cout << "a3 = " << a3 << endl;
    cout << "b3 = " << b3 << endl;

    return 0;
}